package org.wmq.organizationmanagement.common;

import lombok.Data;

@Data
public class Result<T> {
    private int code;
    private String msg;
    private T data;
    private Result(int code,String msg,T data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> Result<T> ok(){
        return new Result<>(200,"ok",null);
    }

    public static <T> Result<T> ok(T data){
        return new Result<>(200,"ok",data);
    }

    public static <T> Result<T> error(String msg){
        return new Result<>(500,msg,null);
    }
}
